# -*- coding: utf-8 -*-
# @Time         : 2022/10/17 22:47
# @Author       : Jinxing Lin
# @StudentNumber: 20216523
# @Affiliation  : SUN YAT-SEN UNIVERSITY  SCHOOL OF SYSTEMS SCIENCE AND ENGINEERING
# @Mail         ：linjx83@mail2.sysu.edu.cn
# @FileName     : draw_hist.py
# @Software     : PyCharm

import numpy as np
import matplotlib.pyplot as plt
import os  # 导入os库
import pandas as pd

def plot_hist(cp_path="data/cst_cp.csv"):
    """
        把关于cp的直方图展示出来
    :param cp_path:
    :return:
    """

    # 读取数据
    df = pd.read_csv(cp_path, index_col=0, header=None)
    df.columns = ["cp"]#, "percentage", "count"]

    x = df["cp"].values
    plt.rcParams['axes.unicode_minus'] = False  # 显示负号\n",
    plt.figure(figsize=(6, 4))  ## 设置画布\n",
    plt.hist(x, bins=50)
    plt.show()


if __name__ == "__main__":

    plot_hist(r"D:\pycharm_workspace\visual\visual_distribution\data\cp_diff_percentage_GAN_resample_ml.csv")
